package com.itheima.fanshe;

import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.util.Arrays;

public class Demo02 {

    public static void main(String[] args) throws Exception {
        Class<Student> clazz = (Class<Student>) Class.forName("com.itheima.fanshe.Student");

        Field name = clazz.getDeclaredField("name");
        System.out.println(name);
        Field[] fields = clazz.getDeclaredFields();
        System.out.println(Arrays.toString(fields));
        Student student = clazz.getDeclaredConstructor().newInstance();
        name.setAccessible(true);
        name.set(student,"吴签");
     //   System.out.println(student);
        String s = (String) name.get(student);
        System.out.println(s);
    }
}
